<% result ||= @result %>
<% asset = result.asset %>
<% comments = result.result_comments %>
<% timestamp = asset.created_at %>
<% icon_class = 'fas ' + file_fa_icon_class(asset) if asset.file_name %>
<div class="report-element report-result-element report-result-asset-element"
     data-ts="<%= timestamp.to_i %>"
     data-type="result_asset"
     data-id='{ "result_id": <%= result.id %> }'
     data-scroll-id="<%= result.id %>"
     data-modal-title="<%= t("projects.reports.elements.modals.result_contents.head_title", result: result.name) %>"
     data-name="<%= result.name %>"
     data-icon-class="<%= icon_class %>">
  <div class="report-element-header">
    <div class="row">
      <div class="pull-left result-icon">
        <%= file_extension_icon_html(asset, true) %>
      </div>
      <div class="pull-left result-name">
        <%= result.name %>
        <% if result.archived? %>
          <span class="label label-warning"><%= t('search.index.archived') %></span>
        <% end %>
      </div>
      <div class="pull-left file-name">
        <% if defined? export_all and export_all %>
          <a href="<%= path[:file] %>">
            <em><%= t("projects.reports.elements.result_asset.file_name", file: filename) %></em>
          </a>
        <% else %>
          <em>
            <%= t("projects.reports.elements.result_asset.file_name",
                    file: truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH)) %>
            <%= link_to t('projects.reports.elements.download'), asset_download_url(asset, disposition: 'attachment'), class: 'download-link', target: :_blank %>
          </em>
        <% end %>
      </div>
      <div class="pull-left user-time">
        <%= t("projects.reports.elements.result_asset.user_time", user: result.user.full_name, timestamp: l(timestamp, format: :full)) %>
      </div>
      <div class="pull-right controls">
        <%= render partial: "reports/elements/element_controls.html.erb" %>
      </div>
    </div>
  </div>
  <div class="row"></div>
  <% if asset.previewable? && !asset.list? %>
    <div class="report-element-body">
        <div class="row">
          <div class="col-xs-12 file-image">
            <% if defined?(export_all) && export_all %>
              <img class="report-export-img" src="<%= path[:preview] %>">
            <% else %>
              <%= report_image_asset_url(asset) %>
            <% end %>
          </div>
        </div>
    </div>
  <% end %>
  <div class="report-element-children">
    <%= children if (defined? children and children.present?) %>
  </div>
</div>
